﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

namespace Cloak.Mvp
{
	/// <summary>
	/// Describes a context in which views, presenters, and domain model elements are composed
	/// </summary>
	[ContractClass(typeof(IMvpContextContract))]
	public interface IMvpContext
	{
		/// <summary>
		/// Enrolls the specified view in this context using the specified presentation instructions
		/// </summary>
		/// <param name="view">The view to be presented</param>
		/// <param name="presentation">Instructions on how to present the view</param>
		void Present(object view, ViewPresentation presentation);
	}

	[ContractClassFor(typeof(IMvpContext))]
	internal abstract class IMvpContextContract : IMvpContext
	{
		void IMvpContext.Present(object view, ViewPresentation presentation)
		{
			Contract.Requires(view != null);
			Contract.Requires(presentation != null);
		}
	}
}